import axios from '@/libs/axios1';
let jsonHeaders = { 'content-type': 'application/json;charset=UTF-8' };
let baseUrl = '/scientific/group';

//查询
export const queryGroup = (data) => {
    return axios({
        url: `${baseUrl}/page`,
        method: 'GET',
        params: data,
        headers: jsonHeaders,
    });
};

// 添加
export const addGroup = (data) => {
    return axios({
        url: `${baseUrl}`,
        method: 'POST',
        data,
        headers: jsonHeaders,
    });
};

// 修改
export const updateGroup = (id,data) => {
    return axios({
        url: `${baseUrl}/${id}`,
        method: 'PUT',
        data,
        headers: jsonHeaders,
    });
};

// 删除
export const delGroup = (id) => {
    return axios({
        url: `${baseUrl}/${id}`,
        method: 'DELETE',
        headers: jsonHeaders,
    });
};

//添加组成员
export const addGroupUser = (contentId,id,data) => {
    return axios({
        url: `${baseUrl}/${contentId}/add/${id}`,
        method: 'POST',
        data,
        headers: jsonHeaders,
    });
};


// 删除人员
export const delGroupUser = (id,userIds) => {
    return axios({
        url: `${baseUrl}/del/${id}`,
        method: 'DELETE',
        data:userIds,
        headers: jsonHeaders,
    });
}

//获取科研下所有人员
export const queryAllGroupUser = (contentId) => {
    return axios({
        url: `${baseUrl}/allUser/${contentId}`,
        method: 'GET',
        params: {},
        headers: jsonHeaders,
    });
};